#include <stdio.h>
#include <stdlib.h>

int temp(void* a1, void* a2)
{
    return *(int*)a1 - *(int*)a2; 
}
int findLHS(int* nums, int numsSize) {
    qsort(nums, numsSize, sizeof(int), temp);
    int left = 0, right = 0, slide = 0, flag = 0;
    if (numsSize == 1)
    {
        return 0;
    }
    for (int i = 1;;)
    {
        if (nums[i] == nums[left])
        {
            i++;
        }
        else if (nums[i] - nums[left] == 1)
        {
            slide = i - left + 1;
            i++;
        }
        else if (nums[i] - nums[left] != 1)
        {
            left++;
            i = left + slide;
        }

        if (i > numsSize - 1)
        {
            break;
        }
    }
    return slide;
}



int main()
{
	return 0;
}